<!--  -->
<template>
  <div class="tab_control">
        <div v-for="(item,index) in itemtitle" class="itemtitle" @click="itemClick(index)" :class="{active:index === currentItem}">
          <span>{{item}}</span>
        </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      currentItem:0
    }
  },
  props:{
    itemtitle:{
      type: Array,
      default() {
        return []
      }
    }
  },
  methods:{
    itemClick(index) {
      this.currentItem=index;
      this.$emit('tabClick',index)
    }
  }
}
</script>

<style  scoped>
  .tab_control{
    display: flex;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 15px;
    background-color: #fff;
  }
  .itemtitle{
    flex: 1;
  }
  .itemtitle span {
    padding: 5px;
  }
  .active{
    color: var(--color-high-text);
  }
  .active span {
    border-bottom: 3px solid #ff8198;
  }
</style>
